import request from '@/utils/request'

// 查询顺序列表
export function listShunxu(query) {
    return request({
        url: '/work/competition/order/list',
        method: 'get',
        params: query
    })
}

// 查询顺序详细
export function getShunxu(id) {
    return request({
        url: '/work/competition/order/OrderInfo',
        method: 'get',
        params: { "id": id }
    })
}

// 新增顺序
export function addShunxu(data) {
    return request({
        url: '/work/competition/order/saveOrUpdate',
        method: 'post',
        data: data
    })
}

// 修改顺序
export function updateShunxu(data) {
    return request({
        url: '/work/competition/order/saveOrUpdate',
        method: 'post',
        data: data
    })
}

// 删除顺序
export function delShunxu(id) {
    return request({
        url: '/work/competition/order/delete-by-id',
        method: 'get',
        params: { "id": id }
    })
}

//获取比赛详细信息
// 查询比赛详细
export function getplay(id) {
    return request({
        url: '/work/competition/' + id,
        method: 'get'
    })
}


export function getApplys(params) {
    return request({
        url: '/work/competition/getApplyProjectByGroupAndProject',
        method: 'get',
        params: params
    })
}


//设置裁判

export function setReffer(data) {
    return request({
        url: '/work/competition/referee/set',
        method: 'post',
        data: data
    })
}

//获取场次裁判
export function getOrderReffers(orderId) {
    return request({
        url: '/work/competition/referee/get',
        method: 'get',
        params: { "orderId": orderId }
    })
}

// 根据场次id修改场次状态
export function startOrder(orderId) {
    return request({
        url: '/work/competitionorderreferee/startOrder',
        method: 'get',
        params: { "orderId": orderId }
    })
}
//场次 结束比赛
export function endOrder(orderId) {
    return request({
        url: '/work/competitionorderreferee/endOrder',
        method: 'get',
        params: { "orderId": orderId }
    })
}
// 开始打分
export function startScore(orderId, applyProjectId) {
    return request({
        url: '/work/competitionorderreferee/startScore',
        method: 'get',
        params: {
            "orderId": orderId,
            "applyProjectId": applyProjectId
        }
    })
}

//结束打分

export function endScore(applyProjectId) {
    return request({
        url: '/work/competitionorderreferee/endScore',
        method: 'get',
        params: {

            "applyProjectId": applyProjectId
        }
    })
}
// 弃权

export function abstention(applyProjectId) {
    return request({
        url: '/work/competitionorderreferee/abstention',
        method: 'get',
        params: {

            "applyProjectId": applyProjectId
        }
    })
}

// 根据项目id获取打分情况

export function refferScore(applyProjectId, orderId) {
    return request({
        url: '/work/competitionorderreferee/getScoresByApplyProjectId',
        method: 'get',
        params: {

            "applyProjectId": applyProjectId,
            "orderId": orderId
        }
    })
}

//提交打分
export function submitScore(data) {
    return request({
        url: '/work/competitionorderreferee/submitScore',
        method: 'post',
        data: data
    })
}

//导出
export function underOrder() {
    return request({
        url: '/work/competition/downloadTemplate',
        method: 'get'
    })
}


// 根据项目id获取打分情况

export function gameSort(orderId) {
    return request({
        url: '/work/competition/scoreSort',
        method: 'get',
        params: {
            "orderId": orderId
        }
    })
}

//重新打分
export function reStartScore(orderId, applyProjectId) {
    return request({
        url: '/work/competitionorderreferee/reStartScore',
        method: 'get',
        params: {
            "orderId": orderId,
            "applyProjectId": applyProjectId
        }
    })
}